package task3_20;

import java.util.Scanner;

/**
 * @author banana
 * 抛出异常
 */
public class ThrowsTest {
    public static void main(String[] args) {
        System.out.println("请输入被除数");
        Scanner scanner=new Scanner(System.in);
        int a=scanner.nextInt();
        System.out.println("请输入除数");
        int b=scanner.nextInt();
        //调用方法完成除法，一种是用户主动加try eatch
        //另一种:用户必须加try.eatch
        int result= 0;
        try {
            result = Divide.myDivide(a,b);
            System.out.println("结果是："+result);
        } catch (Exception e) {
            System.out.println("异常时："+e.getMessage());
        }finally{
            System.out.println("可写可不写，都会执行");
        }

    }
}
